import 'package:flutter/material.dart';
import 'package:painter_demo/widgets/slider_controller.dart';
import 'package:painter_demo/widgets/slider_vertical.dart';

class VerticalDemo extends StatefulWidget {
  const VerticalDemo({super.key});

  @override
  State<VerticalDemo> createState() => _VerticalDemoState();
}

class _VerticalDemoState extends State<VerticalDemo> {
  final sliderController = SliderController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
      appBar: AppBar(
        title: const Text('竖直Demo'),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Center(
            child: SliderVertical(
              size: 200,
              value: 80,
              minValue: 70,
              maxValue: 90,
              onChanged: (value) {
                print('onChanged: $value');
              },
              sliderController: sliderController,
            ),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              IconButton(
                onPressed: sliderController.onAddStepClick,
                icon: const Text(
                  '+',
                  style: TextStyle(fontSize: 30, color: Colors.white),
                ),
              ),
              IconButton(
                onPressed: sliderController.onSubStepClick,
                icon: const Text(
                  '-',
                  style: TextStyle(fontSize: 30, color: Colors.white),
                ),
              )
            ],
          ),
        ],
      ),
    );
  }
}
